package com.sidemenu.demo

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.sidemenu.demo.databinding.ActivityChatGroupBoardBinding


class ChatGroupBoardActivity : AppCompatActivity() {

    companion object {
        @JvmStatic
        fun jumpTo(context: Context) {
            context.startActivity(Intent(context, ChatGroupBoardActivity::class.java))
        }
    }

    private lateinit var mAdapter: ChatGroupBoardAdapter
    private lateinit var mBinding: ActivityChatGroupBoardBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        mBinding = ActivityChatGroupBoardBinding.inflate(layoutInflater)
        //setContentView(R.layout.activity_chat_group_board)
        setContentView(mBinding.root)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }

        onInitRecyclerView(mBinding.rvBoard)
    }


    private fun onInitRecyclerView(rv: RecyclerView) {
        rv.layoutManager = GridLayoutManager(rv.context, 3)
        rv.setHasFixedSize(true)
        /*rv_mall_cart.addItemDecoration(RvItemDecoration.Builder(mContext)
                .bgColor(R.color.c_edf4f8)
                .widthDp(1f)
                .setOrientation(LinearDecoration.VERTICAL)
                .createLinear())*/
        mAdapter = ChatGroupBoardAdapter(
            mutableListOf(
                BoardData("在线人数"),
                BoardData("活跃人数"),
                BoardData("群人数"),
                BoardData("商品购买数量"),
                BoardData("商品成交金额"),
                BoardData("产生佣金"),
                BoardData("商品分享人数"),
                BoardData("商品购买人数"),
                BoardData("商品分享次数")
            )
        )
        rv.adapter = mAdapter
        //mAdapter.setOnItemClickListener { adapter, view, position -> }
    }

}